/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ModuloBaseDelConocimiento;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author rayner
 */
@Entity
@Table(name = "Caso")
@NamedQueries({
    @NamedQuery(name = "Caso.findAll", query = "SELECT c FROM Caso c"),
    @NamedQuery(name = "Caso.findById", query = "SELECT c FROM Caso c WHERE c.id = :id"),
    @NamedQuery(name = "Caso.findByDescripcion", query = "SELECT c FROM Caso c WHERE c.descripcion = :descripcion"),
    @NamedQuery(name = "Caso.findByEdadPaciente", query = "SELECT c FROM Caso c WHERE c.edadPaciente = :edadPaciente"),
    @NamedQuery(name = "Caso.findBySexoPaciente", query = "SELECT c FROM Caso c WHERE c.sexoPaciente = :sexoPaciente")})
public class Caso implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "descripcion")
    private String descripcion;
    @Column(name = "edadPaciente")
    private Integer edadPaciente;
    @Column(name = "sexoPaciente")
    private Integer sexoPaciente;
    @JoinColumn(name = "Enfermedad_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Enfermedad enfermedad;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "caso")
    private List<SintomaOSigno> sintomaOSignoList;

    public Caso() {
    }

    public Caso(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Integer getEdadPaciente() {
        return edadPaciente;
    }

    public void setEdadPaciente(Integer edadPaciente) {
        this.edadPaciente = edadPaciente;
    }

    public Integer getSexoPaciente() {
        return sexoPaciente;
    }

    public void setSexoPaciente(Integer sexoPaciente) {
        this.sexoPaciente = sexoPaciente;
    }

    public Enfermedad getEnfermedad() {
        return enfermedad;
    }

    public void setEnfermedad(Enfermedad enfermedad) {
        this.enfermedad = enfermedad;
    }

    public List<SintomaOSigno> getSintomaOSignoList() {
        return sintomaOSignoList;
    }

    public void setSintomaOSignoList(List<SintomaOSigno> sintomaOSignoList) {
        this.sintomaOSignoList = sintomaOSignoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Caso)) {
            return false;
        }
        Caso other = (Caso) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ModuloBaseDelConocimiento.Caso[id=" + id + "]";
    }

}
